<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>支付宝授权认证</title>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .f-autonym {
            width: 100%;
            height: 100%;
            text-align: center;
            font-size: 24px;
            margin-top: 20px;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="f-autonym" id="msgBox"></div>
    </div>
</body>
<script>
    var msg = ''
    function getURLParameter(url, paramName) {
        var urlParams = url && url.split("?")[1];
        var paramArray = urlParams && urlParams.split("&");
        var len = paramArray && paramArray.length;
        var paramObj = {};
        var arr = [];
        for (var i = 0; i < len; i++) {
            arr = paramArray[i].split("=");
            paramObj[arr[0]] = arr[1];
        }
        for (var key in paramObj) {
            if (key == paramName) {
                return paramObj[paramName];
                break;
            }
        }
    }
    function init() {
        const that = this
        let url = window.location.href

        let json = {
            appId: that.getURLParameter(url, "app_id"),
            authCode: that.getURLParameter(url, "auth_code"),
            certVerifyId: that.getURLParameter(url, "cert_verify_id"),
            scope: that.getURLParameter(url, "scope"),
            source: that.getURLParameter(url, "source")
        }
        $.ajax({
            url: "/ums/user/non-auth/platform/sign/ali/living/notify",
            type: "post",
            dataType: "json",
            contentType: "application/json",
            data: JSON.stringify(json),
            success: function (res) {
                if (res.code == 200) {
                    that.msg = '已实名认证成功!'
                    $('#msgBox').text(that.msg)
                } else {
                    that.msg = res.msg
                    $('#msgBox').text(that.msg)
                }
            },
            error: function (msg) {
                that.msg = msg
                $('#msgBox').text(that.msg)
            }
        })
    }
    init()
</script>

</html>